package com.zhanglu.gateway.token;

import com.zhanglu.gateway.bean.request.TokenRequest;
import com.zhanglu.gateway.client.AuthenticationClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description
 * @Auther zhanglu
 * @Date 2017/10/20 下午4:03
 */
@Service
@Slf4j
public class TokenService {
    @Autowired
    private AuthenticationClient authenticationClient;

    public String refreshToken(String token) {
        String newToken = authenticationClient.refreshToken(new TokenRequest().setToken(token));
        log.debug("registerToken token is {}", newToken);
        return newToken;
    }
}
